/**
 * 
 */
package Verifier.ArithmeticSystem;

import java.math.BigInteger;

/**
 * This class represents an object which is in a group - this could be an element in a group or an element in a product of groups.
 * Each class which extends this class should implement the features of handling calculations between objects in the group.
 * 
 * @author Moshe Baavur
 */
public abstract class GroupElement {
	/**
	 * Returns a new group element (can be a product or a simple element) which is the result of multiplying the current element with the
	 * other element (both elements should be in the same group).
	 * 
	 * @param other the group element to multiply with this.
	 * @return its value is the result of multiplying the 2 elements in this group.
	 * @throws Exception if the elements, this and other, are from different groups.
	 */
	public abstract GroupElement multiply(GroupElement other) throws Exception;
	
	/**
	 * Returns a new group element (can be a product or a simple element) which is the result of calculating this^exponent.
	 * 
	 * @param exponent the exponent in the calculation.
	 * @return its value is the result of calculating this^exponent in this group.
	 */
	public abstract GroupElement power(BigInteger exponent);
	
	/**
	 * Returns a new group element (can be a product or a simple element) which is the result of dividing the current element by the
	 * other element (both elements should be in the same group).
	 * 
	 * @param other the denominator in the calculation.
	 * @return its value is the result of dividing this by other in this group.
	 * @throws Exception if the elements, this and other, are from different groups.
	 */
	public abstract GroupElement divide(GroupElement other) throws Exception;
	
	/**
	 * Returns the group which the element belongs to.
	 * @return the containing group.
	 */
	public abstract Group getGroup();
}
